package com.dpiinc.TechPage

import android.content.Context
import android.util.Log
import com.beiji.lib.pen.cache.SharedPreferencesHelper

/**
 * 简单配置辅助类
 * Created by X on 2018/7/9.
 */
object AIWriteSettings {

    fun init(context: Context) {
        SharedPreferencesHelper.init(context = context)
    }

    //新用户引导弹框
    private const val KEY_IS_NEW_USER_GUIDE_SHOWED = "key_is_new_user_guide_showed"

    //低电量弹框
    private const val KEY_HAS_LOW_BATTERY_DIALOG_SHOWED = "key_has_low_battery_dialog_showed"

    private const val KEY_OSS_BUCKET = "key_oss_bucket"
    private const val KEY_OSS_DOT_FILE_PREFIX = "key_oss_dot_file_prefix"
    private const val KEY_OSS_AUDIO_FILE_PREFIX = "key_oss_audio_file_prefix"
    private const val KEY_OSS_IMG_FILE_PREFIX = "key_oss_img_file_prefix"

    private const val KEY_NOTE_LIST_LATEST_GET_TIME = "key_note_list_latest_get_time"//最近一次更新列表的时间

    fun isNewUserGuideShowed(): Boolean {
        return SharedPreferencesHelper.getBooleanValue(KEY_IS_NEW_USER_GUIDE_SHOWED, false)
    }

    fun setNewUserGuideShowed(isShowed: Boolean) {
        SharedPreferencesHelper.saveBooleanValue(KEY_IS_NEW_USER_GUIDE_SHOWED, isShowed)
    }

    fun hasLowBatteryDialogShowed(): Boolean {
        return SharedPreferencesHelper.getBooleanValue(KEY_HAS_LOW_BATTERY_DIALOG_SHOWED, false)
    }

    fun setLowBatteryDialogShowed(hasShowed: Boolean) {
        SharedPreferencesHelper.saveBooleanValue(KEY_HAS_LOW_BATTERY_DIALOG_SHOWED, hasShowed)
    }

    fun getOssBucket(): String? {
//        Log.e("xxxxxxxxxxxxxx.xx","x111 xxxxxxx  =  "+SharedPreferencesHelper.getStringValue(KEY_OSS_BUCKET, "bjaiwrite2"))
       return SharedPreferencesHelper.getStringValue(KEY_OSS_BUCKET, "bjaiwrite2")
//        return ""
    }

    fun setOssBucket(bucket: String) {
        SharedPreferencesHelper.saveStringValue(KEY_OSS_BUCKET, bucket)
    }

    fun getOssDotFilePrefix(): String? {
        return SharedPreferencesHelper.getStringValue(KEY_OSS_DOT_FILE_PREFIX, "bjaiwrite2/app/dotData/")
    }

    fun setOssDotFilePrefix(dotFilePrefix: String) {
        SharedPreferencesHelper.saveStringValue(KEY_OSS_DOT_FILE_PREFIX, dotFilePrefix)
    }

    fun getOssAudioFilePrefix(): String? {
        return SharedPreferencesHelper.getStringValue(KEY_OSS_AUDIO_FILE_PREFIX, "bjaiwrite2/app/record/")
    }

    fun setOssAudioFilePrefix(audioFilePrefix: String) {
        SharedPreferencesHelper.saveStringValue(KEY_OSS_AUDIO_FILE_PREFIX, audioFilePrefix)
    }

    fun getOssImgFilePrefix(): String? {
        return SharedPreferencesHelper.getStringValue(KEY_OSS_IMG_FILE_PREFIX, "bjaiwrite2/app/dotPicture/")
    }

    fun setOssImgFilePrefix(audioFilePrefix: String) {
        SharedPreferencesHelper.saveStringValue(KEY_OSS_IMG_FILE_PREFIX, audioFilePrefix)
    }

    fun getNoteListLatestGetTime(): Long {
        return SharedPreferencesHelper.getLongValue(KEY_NOTE_LIST_LATEST_GET_TIME, 0L)
    }

    fun setNoteListLatestGetTime(latestGetTime: Long) {
        SharedPreferencesHelper.saveLongValue(KEY_NOTE_LIST_LATEST_GET_TIME, latestGetTime)
    }


}